package com.botarena.client.battle;

import java.util.List;

import com.botarena.shared.BattleTurn;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.Panel;
import com.google.gwt.user.client.ui.VerticalPanel;

public class FightMovesVisualizer extends VerticalPanel {
	
	private static final int SIZE = 15;
	
	public FightMovesVisualizer(List<BattleTurn> moves) {
		
		int who = 1;
		for (BattleTurn t : moves) {
			int move = t.getField();
			int row = move / SIZE;
			int col = move % SIZE;
			String colLetter = Character.toString((char)(col + 'A'));
			
			Panel p = new HorizontalPanel();
			if (who == 1) {
				Label X = new Label("X");
				X.setStyleName("symbol_cross");
				X.setWidth("30px");
				p.add(X);
			} else {
				Label O = new Label("O");
				O.setStyleName("symbol_circle");
				O.setWidth("30px");
				p.add(O);
			}
			
			p.add(new Label(colLetter + Integer.toString(row+1) + " (" + move + ")"));
			
			add(p);
			
			who = -who;
		}
	}

}
